package ExerciseTwo;

import java.util.Scanner;

public class 用户登录 {

	public static void main(String[] args) {
		
		for(int i=0;i<3;i++)
		{
			String username = "swx";
			
			String password = "020724";
			
			System.out.println("请输入用户名");
			
			Scanner sc = new Scanner(System.in);
			
			String name =sc.nextLine();
			
			System.out.println("请输入密码");
			
			String pwr = sc.nextLine();
			
			if(name.equals(username) && pwr.equals(password))
			{
				System.out.println("登录成功");
				break;
			}
			else
			{
				if((2-i) == 0)
				{
					System.out.println("你的账户已被锁定");
				}
				else
				{
					System.out.println("密码错误,"+"你还有"+(2-i)+"次机会");
				}
			}
		}
	}

}
